﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DIT.Utility;

namespace DIT.DB.Database
{
    public class DatabaseFactory
    {
        public static DatabaseBase GetDatabase(string dbType)
        {
            switch (dbType)
            {
                case "SqlCE":
                    return new SSCEDatabase(DITConfig.AppSettings["SqlCEDataSource"], DITConfig.AppSettings["Password"], DITConfig.AppSettings["StartupScriptPath"]);
                case "SqlLite":
                    return new SLiteDatabase(DITConfig.AppSettings["SqlLiteDataSource"], DITConfig.AppSettings["Password"], DITConfig.AppSettings["StartupScriptPath"]);
                case "SqlServer":
                    return new SqlServerDatabase(DITConfig.AppSettings["SqlServerDataSource"], DITConfig.AppSettings["SqlServerDatabase"]
                                               , DITConfig.AppSettings["UserId"], DITConfig.AppSettings["Password"], null);
                default:
                    throw new ArgumentException("Invalid Database Type");
            }
        }
    }
}
